home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GEMFBIND / VINSTRIN.S < prev    next >
Text File  |  1993-03-26  |  2KB  |  70 lines

  1. ;*========================================================================
  2. ;* VDIFAST Public Domain VDI bindings.
  3. ;*========================================================================
  4.  
  5.  
  6. ;*------------------------------------------------------------------------
  7. ;* Input string.
  8. ;*    09/01/91 - v1.7
  9. ;*         Fixed vXX_string per M. Jaegermann's suggestions.  The ADE
  10. ;*         strings returned by VDI are counted, not nullterm'd, so
  11. ;*         now the loop that copies ADE to ASCII is controlled by the
  12. ;*         contrl[4] (intout) count.
  13. ;*------------------------------------------------------------------------
  14.  
  15.           globl     _vsm_string
  16. _vsm_string:
  17.           globl     _vrq_string
  18. _vrq_string:
  19. ;    .cargs    #8,handle.w,maxlen.w,echoflag.w,echoxy.l,string.l
  20.  
  21. handle      =         8
  22. maxlen      =         10
  23. echoflag  =         12
  24. echoxy      =         14
  25. string      =         18
  26.  
  27.           link        a6,#-4
  28.  
  29.           move.w    maxlen(a6),d0        ;* We have to allocate 'maxlen'
  30.           bpl.b     notneg                ;* words of stack space to hold
  31.           neg.w     d0                    ;* the ADE-type string that VDI
  32. notneg:   ;* will return to us.  The maxlen
  33.           add.w     d0,d0                ;* value may be negative (flag for
  34.           sub.w     d0,sp                ;* VDI to return scancodes), so we
  35.           move.l    sp,-4(a6)            ;* use the abs value in that case.
  36.  
  37. ;          VContrl    #31,,#1,#2
  38.           move.w    handle(a6),-(sp)    ; contrl[6]
  39.           clr.l     -(sp)                ; contrl[5,4]
  40.           move.w    #2,-(sp)            ; contrl[3]
  41.           subq.l    #2,sp                ; contrl[2]
  42.           move.w    #1,-(sp)            ; contrl[1]
  43.           move.w    #31,-(sp)            ; contrl[0]
  44.  
  45.           subq.l    #4,sp                ;* -> ptsout
  46.           move.l    -4(a6),-(sp)        ;* -> intout
  47.           move.l    echoxy(a6),-(sp)    ;* -> ptsin
  48.           pea        maxlen(a6)            ;* -> intin
  49.           pea        16(sp)                ;* -> contrl
  50.  
  51.           move.l    sp,d1
  52.           jsr        vditrap
  53.           lea        20(sp),sp            ;* pop vdipb gunga off of stack.
  54.  
  55.           move.l    -4(a6),a0            ;* Pointer to ADE string on stack.
  56.           move.l    string(a6),a1        ;* Pointer to caller's string area.
  57.           move.w    8(sp),d0            ;* contrl now at top of stack, get length
  58.           beq.b     all_done            ;* take early-out if empty string.
  59. copyloop:
  60.           move.w    (a0)+,d1            ;* Get a word from the ADE string,
  61.           move.b    d1,(a1)+            ;* store the low byte in the caller's
  62.           subq.w    #1,d0                ;* decrement string byte count,
  63.           bne.b     copyloop            ;* loop till all bytes copied.
  64. all_done:
  65.           clr.b     (a1)                ;* force nullterm byte onto string.
  66.           move.w    8(sp),d0            ;* retval is contrl[4]: length.
  67.           unlk        a6                    ;* Dealloc all stack space.
  68.           rts
  69.           end
  70.